package com.whcoding.designpatterns.pattern.proxy;

/**
 * @program: spring-boot-learning
 * @description:JDK动态代理测试类
 * @author: whcoding
 * @create: 2022-09-21 09:59
 **/
public class DynamicProxyTests {

	public static void main(String[] args) {

		//目标类
		TeacherDaoImpl target = new TeacherDaoImpl();
		ITeacherDao instance = (ITeacherDao) new ProxyFactory(target).getProxyInstance();
		//从内存中生成的代理对象
		System.out.println("从内存中生成的代理对象"+instance.getClass());
		//通过代理对象调用目标对象的方法
		instance.teach();
	}
}
